package com.gcxy.controller;


import com.gcxy.core.PageVO;
import com.gcxy.core.R;
import com.gcxy.dto.score.StudentScorePageDTO;
import com.gcxy.dto.score.StudentScoreDTO;
import com.gcxy.service.EvaluateService;
import com.gcxy.vo.score.StudentScorePageVO;
import com.gcxy.vo.score.StudentScoreVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;


import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 评价表（教师评价、学生自我评价记录表） 前端控制器
 * </p>
 *
 * @author Huang先森
 * @since 2024-07-22
 */
@RestController
@RequestMapping("/evaluate")
@Api(tags = "成绩查看")
@Slf4j
public class EvaluateController {

    @Autowired
    private EvaluateService evaluateService;

    /**
     * 根据条件分页查询学生平均成绩和排名
     */
    @GetMapping("/getStudentScorePageByCondition")
    @ApiOperation("根据条件分页查询学生平均成绩和排名")
    public R<PageVO<StudentScorePageVO>> getStudentScorePageByCondition(@Validated StudentScorePageDTO studentScorePageDTO,HttpServletRequest request) {
        return R.Success(evaluateService.getStudentScorePageByCondition(studentScorePageDTO));
    }

    /**
     * 根据条件查询学生所有成绩
     */
    @GetMapping("/getStudentScoresByCondition")
    @ApiOperation("根据条件查询学生成绩详情")
    public R<StudentScoreVO> getStudentScoresByCondition(@Validated StudentScoreDTO studentScoreDTO,HttpServletRequest request) {
        return R.Success(evaluateService.getStudentScoresByCondition(studentScoreDTO));
    }

}

